fix(import): fix configuration causing tax calculation issue#81
Open
arnaud-hours wants to merge 2 commits intomainfrom
Open
fix(import): fix configuration causing tax calculation issue#81arnaud-hours wants to merge 2 commits intomainfrom
arnaud-hours wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts how taxes are interpreted and calculated during order import/quote creation to avoid configuration-dependent tax calculation errors.
Changes:
- Update product tax-rate lookup in the quote import flow to use Magento’s tax
RateRequest(based on quote addresses/customer tax class) instead ofgetCalculatedRate(...). - Simplify “price includes tax” / “shipping includes tax” configuration checks to rely on the core “includes tax” flags rather than display configuration.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
Model/Import/Quote.php |
Switch tax-rate computation to getRateRequest(...) + getRate(...) for address-aware product tax calculation. |
Model/Import/Importorder.php |
Change how priceIncludeTax and shippingIncludeTax are derived from store tax configuration during quote creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+247
to
+255
| $taxRequest = $this->calculation->getRateRequest( | ||
| $this->getShippingAddress(), | ||
| $this->getBillingAddress(), | ||
| $this->getCustomerTaxClassId(), | ||
| $this->getStore() | ||
| ); | ||
| $taxRequest->setProductClassId($magentoProduct->getTaxClassId()); | ||
| $taxRate = $this->calculation->getRate($taxRequest); | ||
|
|
There was a problem hiding this comment.
With this change, the class no longer uses $this->taxCalculation (it was previously used for getCalculatedRate(...)). Consider removing the unused property and its constructor dependency to avoid dead code and reduce DI wiring.
michaelmaslengow
previously approved these changes
Mar 3, 2026
… shipping Marketplace shipping costs are always TTC (tax-inclusive). Magento's setShippingPrice/updateRates treats shipping rates as excl-tax internally and adds tax on top. Previously, the shippingIncludeTax config check was always false (due to display config AND conditions), so tax was always extracted before setting the shipping price. After simplifying the check, shippingIncludeTax became true, skipping extraction and causing Magento to add tax on top of an already-TTC amount (double-taxation). Fix: always extract shipping tax using address-based getRateRequest (consistent with the product tax fix in Quote.php), since marketplace shipping is always TTC regardless of Magento's config. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
michaelmaslengow
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.